using System.Web;
using Toast.Core;
using Toast.Extensions;

namespace Toast
{
    public class RequestContentTable
    {
        public static ContentCollection Contents
        {
            get
            {
                var rst = HttpContext.Current.Items["___RequestContentTable"] as ContentCollection;

                if (rst == null)
                {
                    rst = new ContentCollection();

                    RequestId = ShortGuid.NewGuid();

                    if (!HttpContext.Current.Request.IsAjaxRequest())
                        rst.Add(Core.ToastCore.CommonContent());

                    HttpContext.Current.Items["___RequestContentTable"] = rst;
                }

                return rst;
            }
        }

        public static string RequestId { get; set; }

        public string WhatHaveIGot()
        {
            // TODO: Implement WhatHaveIGot to return textual description of scripts registered.
            return string.Empty;
        }
    }
}